<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
export default {
  name: "App",
  data() {
    return {
      _beforeUnload_time: '',
      _gap_time: ''
    }
  },
  mounted() {
    window.addEventListener('beforeunload', (e) => {
      this._beforeUnload_time = new Date().getTime()
    })
    window.addEventListener('unload', () => {
      this._gap_time = new Date().getTime() - this._beforeUnload_time
      if (this._gap_time <= 5) {
        //关闭
        localStorage.clear()
      } else {
        // 刷新
      }
    })
  },
  // destroyed() {
  //   window.removeEventListener('beforeunload')
  //   window.removeEventListener('unload')
  // }
};
</script>

<style>
html,
body {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 0px;
  margin: 0px;
}

#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  widows: 100%;
  height: 100%;
}
</style>
